<?php
/**
 * 新闻类
 * @author hemuhan
 * 
 */
class NewsAction extends Action
{
	public function type()
	{
		$DB = M('newstype');
		$typelist = $DB->select();
		$this->assign('typelist',$typelist);	//列表
		
		$this->display('typemanage');
	}
	public function index()
	{
		
		
		
		$this->display();
	}
	
	
	public function savetype()
	{
		$DB = D('newstype');

		$DB->create() or $this->sendExtmsg(false,$DB->getError());
		$DB->add();
		$this->sendExtmsg(true,'添加成功 ');
	}
	
	public function sendExtmsg($bool,$msg)
	{
		echo json_encode(array('success'=>$bool,'msg'=>$msg));
		exit();
	}
}